﻿@model PagedList<Customer>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/css/select.css" rel="stylesheet" type="text/css" />
    <link href="/css/userinfostyle.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script src="~/Scripts/mustache.js"></script>
    <script type="text/javascript" src="/js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="/js/select-ui.min.js"></script>
    <script language="javascript">
        $(function () {
            //导航切换
            $(".imglist li").click(function () {
                $(".imglist li.selected").removeClass("selected")
                $(this).addClass("selected");
            })
        })
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".click").click(function () {
                $(".tip").fadeIn(200);
            });

            $(".tiptop a").click(function () {
                $(".tip").fadeOut(200);
            });

            $(".sure").click(function () {
                $(".tip").fadeOut(100);
            });

            $(".cancel").click(function () {
                $(".tip").fadeOut(100);
            });

            //用户添加
            $(".clickopensearch").click(function () {
                $(".tipopensearch").fadeIn(200);
            });
            $(".tiptopopensearch a").click(function () {
                $(".tipopensearch").fadeOut(200);
            });

            $(".sureopensearch").click(function () {
                $(".tipopensearch").fadeOut(100);
            });


            $(".cancelopensearch").click(function () {
                $(".tipopensearch").fadeOut(100);
            });

            //删除用户
            $(".clickdel").click(function (del) {
                $(".tipdel").fadeIn(200);
            });

            $(".tiptopdel a").click(function (del) {
                $(".tipdel").fadeOut(200);
            });
            $(".suredel").click(function (del) {
                $(".tipdel").fadeOut(100);
            });
            $(".canceldel").click(function (del) {
                $(".tipdel").fadeOut(100);
            });

            //修改用户
            $(".clickmodify").click(function () {
                if ($('input:checked').length > 1 || $('input:checked').length < 1) {
                    alert("请选择一项纪录修改！"); return;
                }
                window.location.href = '/user/Add_OpenAccountCharge?customerId=' + $('input:checked').attr('customerId');
            });

            $(".tiptopmodify a").click(function () {
                $(".tipmodify").fadeOut(200);
            });

            $(".suremodify").click(function () {
                $(".tipmodify").fadeOut(100);
            });

            $(".cancelmodify").click(function () {
                $(".tipmodify").fadeOut(100);
            });


            $('table input').click(function () {
                var len = $('table').find('input:checked').not(this).removeAttr("checked");
                if ($(this).is(":checked")) {
                    var customerId = $(this).val();
                    $.post('/user/GetDocumentsByCustomerId', { customerId: customerId }, function (data) {
                        if (data.Succeed) {
                            var renderHtml = Mustache.render($('#documentTemplate').html(), data.Obj);
                            $('.kh').html(renderHtml);
                        } else {
                            $('.kh').html('');
                        }
                    }, 'json')


                }
            })





        });
    </script>
    <script type="text/javascript">
        $(document).ready(function (e) {
            $(".select1").uedSelect({
                width: 345
            });
            $(".select2").uedSelect({
                width: 167
            });
            $(".select3").uedSelect({
                width: 150
            });
        });
    </script>
    <script type="text/template" id="documentTemplate">

        <table class="imgtable">
            <thead>
                <tr>
                    <th>编号</th>
                    <th>材料名称</th>
                    <th>材料单位</th>
                    <th>材料单价</th>
                    <th>材料数量</th>
                    <th>材料金额</th>
                    <th>材料备注</th>
                </tr>
            </thead>
            <tbody id="tbody1">
                {{#Documents}}
                <tr>
                    <td>{{Id}} </td>
                    <td>{{DocumentName}}</td>
                    <td>{{DocumentUnit}}</td>
                    <td>{{DocumentPrice}} </td>
                    <td>{{DocumentNum}}</td>
                    <td>{{TotalPrice}}</td>
                    <td>{{DocumentDesc}}</td>
                </tr>
                {{/Documents}}
            </tbody>
            <tfoot id="tfoot1">
                <tr> <td>总计金额</td> <td colspan="6">{{AllPrice}}</td>   </tr>
            </tfoot>
        </table>
    </script>
</head>
<body>
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">用户管理</a></li>
            <li><a href="#">用户开户查询</a></li>
        </ul>
    </div>
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li class="clickopensearch"><span><img src="/images/t07.png" /></span>开户查询</li>
                <li class="clickmodify"><span><img src="/images/t02.png" /></span>开户修改</li>
                <li class="clickdel"><span><img src="/images/t03.png" /></span>开户作废</li>
                <li class="click"><span><img src="/images/t09.png" /></span>导出开户</li>
                <li class="click"><span><img src="/images/t08.png" /></span>打印开户</li>
            </ul>

        </div>
        <table class="imgtable">
            <thead>
                <tr>
                    <th>选择</th>
                    <th>用户编号</th>
                    <th>用户姓名</th>
                    <th>身份证号</th>
                    <th>联系电话</th>
                    <th>区域分布</th>
                    <th>区域名称</th>
                    <th>详细地址</th>
                    <th>水表编号</th>
                    <th>水表初值</th>
                    <th>用户状态</th>
                    <th>房屋类型</th>
                    <th>用水类别</th>
                    <th>水表性质</th>
                    <th>分表？</th>
                    <th>抄表人员</th>
                    <th>开户日期</th>
                    <th>备注</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {

                    <tr jsonModel="@(JsonConvert.SerializeObject(item,new JsonSerializerSettings{ReferenceLoopHandling = ReferenceLoopHandling.Ignore}))">
                        <td><input name="" type="checkbox" customerId="@(item.CustomerId)" value="@(item.Id)" /></td>
                        <td>@(item.CustomerId)</td>
                        <td height="30px;">@(item.CustomerName)</td>
                        <td><a href="#">@(item.PersonId)</a></td>
                        <td>@(item.LinkPhone)</td>
                        <td>@(item.FirstArea)</td>
                        <td>@(item.SecondArea)</td>
                        <td>@(item.DetailAddress)</td>
                        <td>@(item.MeterNo)</td>
                        <td>@(item.MeterStart)</td>
                        <td>@(((Customer.CustomStatEnum)item.CustomerStat).ToDescription())</td>
                        <td>@(((Customer.HouseTypeEnum)item.HouseType).ToDescription())</td>
                        <td>@(item.WaterType?.TypeName)</td>
                        <td>@(((Customer.MeterNatureEnum)item.MeterNature).ToDescription())</td>
                        <td>@(item.ParentId == null ? "-" : "分表")</td>
                        <td>@(item.EmployeeInfo?.NAME)</td>
                        <td>@(item.OpenAccountDate?.ToString("yyyy/MM/dd"))</td>
                        <td>
                            @(item.DESCRIPTION)
                        </td>
                    </tr>
                }

            </tbody>
        </table>

        <div class="pagin">
            <div class="message">共<i class="blue">@(Model.TotalItemCount)</i>条记录，共&nbsp;<i class="blue">@(Model.TotalPageCount)&nbsp;</i>页</div>
            @Html.Pager(Model, BaseController.PagerOptions)
        </div>


        <!--材料信息-->
        <div class="kh"></div>




        <!--用户查询-->
        <div class="tipopensearch">
            <div class="tiptopopensearch"><img src="/images/t06.png" /><span>开户查询</span><a></a></div>
            <div class="tipinfoopensearch">
                <div class="tiprightopensearch">

                    <ul class="seachform">
                        <li>
                            <label>用户编号</label>
                            <input name="CustomerId" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>为止编号</label>
                            <input name="EndCustomerId" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>用户姓名</label>
                            <input name="CustomerName" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>身份证号</label>
                            <input name="PersonId" type="text" class="scinput" />
                        </li>
                        @Html.Action("_LinkArea", "Common")
                        <li>
                            <label>联系电话</label>
                            <input name="LinkPhone" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>水表编号</label>
                            <input name="MeterNo" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>水表初值</label>
                            <input name="MeterStart" type="text" class="scinput" />
                        </li>
                        <li>
                            <label>用户状态</label>
                            <div class="vocation">
                                @Html.Action("_EnumSelect", "Common", new { className = "Customer+CustomStatEnum", namespaces = "Kongt.Model", name = "CustomerStat", cssClass = "select3" })
                            </div>
                        </li>
                        <li>
                            <label>房屋类型</label>
                            <div class="vocation">
                                @Html.Action("_EnumSelect", "Common", new { className = "Customer+HouseTypeEnum", namespaces = "Kongt.Model", name = "HouseType", cssClass = "select3" })
                            </div>
                        </li>
                        @Html.Action("_WaterType", "Common", new { id = "addsellssss" })
                        <li>
                            <label>抄表人员</label>
                            <div class="vocation">
                                @Html.Action("_Employees", "Common", new { cssClass = "select3" })
                            </div>
                        </li>
                        <li>
                            <label>水表性质</label>
                            <div class="vocation">
                                @Html.Action("_EnumSelect", "Common", new { className = "Customer+MeterNatureEnum", namespaces = "Kongt.Model", name = "MeterNature", cssClass = "select3" })
                            </div>
                        </li>
                        <li>
                            <label>开户日期</label>
                            <div class="vocation">
                                <select class="select3" name="OpenAccountDate">
                                    @{
                                        var dateStart = DateTime.Now.AddDays(-DateTime.Now.Day).AddDays(1);
                                        var dateEnd = DateTime.Now.AddMonths(1).AddDays(-DateTime.Now.Day);
                                        var tempDate = dateStart;
                                    }
                                    <option value="">请选择</option>
                                    @while (tempDate >= dateStart && tempDate <= dateEnd)
                                    {
                                        <option value="@(tempDate.ToString("yyyy/MM/dd"))">@tempDate.ToString("yyyy年MM月dd日")</option>
                                        tempDate = tempDate.AddDays(1);
                                    }
                                </select>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="tipbtnopensearch">
                <input name="" type="button" class="sureopensearch" value="查询" />
                &nbsp;
                <input name="" type="button" class="cancelopensearch" value="取消" />
            </div>
        </div>


        <!--删除用户-->
        <div class="tipdel">
            <div class="tiptopdel"><span>提示信息</span><a></a></div>
            <div class="tipinfodel">
                <span><img src="/images/ticon01.png" /></span>
                <div class="tiprightdel">
                    <p>确定要作废【<font color="#ff0000">GL01021</font>】用户？</p>
                    <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
                </div>
            </div>
            <div class="tipbtndel">
                <input name="" type="button" class="suredel" value="确定" />
                &nbsp;
                <input name="" type="button" class="canceldel" value="取消" />
            </div>
        </div>

    </div>

</body>
</html>
